package jfuzzyprincepless.zarchive.negotiation.protocols;

import java.util.*;

import jfuzzyprincepless.zarchive.algorithm.structure.ICommandConstruction;
import jfuzzyprincepless.negotiation.INegotiation;
import jfuzzyprincepless.negotiation.INegotiationContext;

// archivtodo F IXME: rename 2 ChainNegotiationProtocol
public class ChaitNegotiationProtocol
	implements INegotiationProtocol__Q_del
{
	private INegotiation defaultNegotiation = null;

	private List<INegotiationProtocol__Q_del> stagesList =
		new LinkedList<INegotiationProtocol__Q_del>();

	@Override
	public INegotiation createNegotiation(
		ICommandConstruction construction,
		INegotiationContext context
	) {
		for (INegotiationProtocol__Q_del stage : getStagesList()) {
			INegotiation negotiation =
				stage.createNegotiation(construction, context);
			if (negotiation != null) {
				return negotiation;
			}
		}
		return defaultNegotiation;
	}

	public List<INegotiationProtocol__Q_del> getStagesList() {
		return stagesList;
	}
}
